import { defineStore } from 'pinia'

export interface NavItem {
    path: string
    isNav: boolean
    name:  string,
    title?: string
    icon?: string
}

const state = () => {
    return {
        navList: [] as Array<NavItem>,
        currentName: 'Index' as string
    }
}

export const useNavStore = defineStore('nav', {
    state,
    actions: {
        // 设置菜单列表
        setNavList(list ?: Array<NavItem>): any {
            this.navList = list!
        },
        // 设置当前菜单
        setCurrentName(name?: string) {
            
            this.currentName = name!
        }
    }
})